/*
 *
 *  AutoWallpaper (Android) Version 1.x
 *  Copyright (C) 2010 - 2011, Tyler H. Jones (me@tylerjones.me)
 *  http://www.autowallpaper.org/
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */


package com.tylerhjones.autowallpaper;

// TODO: Auto-generated Javadoc
/**
 * The Class Common.
 */
public class Common {
	
	/** The Constant DB_NAME. */
	public static final String DB_NAME = "autowallpaper.db";
	
	/** The Constant TABLE_IMAGES. */
	public static final String TABLE_IMAGES = "images";
	
	/** The Constant S_FIELD_PATH. */
	public static final String S_FIELD_PATH = "path";
	
	/** The Constant S_FIELD_INDEX. */
	public static final String S_FIELD_INDEX = "id";
	
	/** The Constant S_FIELD_TIMESVIEWED. */
	public static final String S_FIELD_TIMESVIEWED = "times_viewed";
	
	/** The Constant S_FIELD_LASTVIEWED. */
	public static final String S_FIELD_LASTVIEWED = "last_viewed";
	
    /** The Constant SETTINGS. */
    public static final String SETTINGS = "com.tylerhjones.autowallpaper.settings";
	
	/** The Constant CNF_STARTUP. */
	public static final String CNF_STARTUP = "startup";
	
	/** The Constant CNF_WPMODE. */
	public static final String CNF_WPMODE = "wpmode";
	
	/** The Constant CNF_ACTIVE. */
	public static final String CNF_ACTIVE = "active";
	
	/** The Constant CNF_RANDOM. */
	public static final String CNF_RANDOM = "random";
	
	/** The Constant CNF_CURIMG. */
	public static final String CNF_CURIMG = "curimg";
	
	/** The Constant CNF_IMGSRC. */
	public static final String CNF_IMGSRC = "imgsrc";
	
	/** The Constant CNF_INTERVAL. */
	public static final String CNF_INTERVAL = "interval";
	
	/** The Constant CNF_FIRSTRUN. */
	public static final String CNF_FIRSTRUN = "firstrun";
	
	/** The Constant CNF_BETAWARN. */
	public static final String CNF_BETAWARN = "betawarn";
	
	/** The Constant CNF_NUMIMAGES. */
	public static final String CNF_NUMIMAGES = "numimages";
	
	/** The Constant DB_VERSION. */
	public static final int DB_VERSION = 2;
	
	/** The Constant APP_AUTHOR. */
	public static final String APP_AUTHOR = "Tyler H. Jones";
	
	/** The Constant APP_VERSION. */
	public static final String APP_VERSION = "1.0.7 Beta";
	
	/** The Constant MEDIA_IMAGE_REQUEST_CODE. */
	public static final int MEDIA_IMAGE_REQUEST_CODE = 54375;
	
	/** The Constant GALLERY_IMAGE_REQUEST_CODE. */
	public static final int GALLERY_IMAGE_REQUEST_CODE = 7634;
	
	/** The Constant IMAGE_MANAGER_REQUEST_CODE. */
	public static final int IMAGE_MANAGER_REQUEST_CODE = 3725;
    
    /** The Constant AWSERVICE_NOTIFY_ID. */
    public static final int AWSERVICE_NOTIFY_ID = 1100;
    
    public static final int INTERVAL_UNLOCK = 10000;
    public static final int INTERVAL_SYSSTART = 9999;
    public static final int INTERVAL_DAILY = 288;

			
	/**
	 * Gets the setting value from interval spinner.
	 *
	 * @param text the text
	 * @return the setting value from interval spinner
	 */
	public String getSettingValueFromIntervalSpinner(String text) {
		if(text=="5 Minutes") { return "1"; }
		if(text=="10 Minutes") { return "2"; }
		if(text=="30 Minutes") { return "6"; }
		if(text=="1 Hour") { return "12"; }
		if(text=="2 Hours") { return "24"; }
		if(text=="4 Hours") { return "48"; }
		if(text=="6 Hours") { return "72"; }
		if(text=="8 Hours") { return "96"; }
		if(text=="12 Hours") { return "144"; }
		if(text=="Daily") { return "288"; }
		if(text=="At System Start") { return "9999"; }
		if(text=="On Lock-Screen Unlock") { return "10000"; }
		return "6";
	}
	
	/**
	 * B2s.
	 *
	 * @param val the val
	 * @return the string
	 */
	public String b2s(boolean val) {  //bool2str
		if(val) { return "TRUE"; } else { return "FALSE"; }
	}
	
	/**
	 * S2b.
	 *
	 * @param val the val
	 * @return true, if successful
	 */
	public boolean s2b(String val) {  //str2bool
		if(val.toUpperCase() == "TRUE") { return true; } 
		if(val.toUpperCase() == "FALSE") { return false; }
		return false;
	}
}
